<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:p="http://primefaces.org/ui"
                xmlns:f="http://java.sun.com/jsf/core"
                template="/templates/template.xhtml">
    <ui:define name="metadata">
    </ui:define>
    <ui:define name="content">
        <section class="content-header">
            <h1>
                Consulta
                <small>Películas</small>
            </h1>
            <ol class="breadcrumb">
                <li><a href="#"><i class="fa fa-home"></i> Inicio</a></li>
                <li><a href="#"><i class="fa fa-laptop"></i> Consulta de Películas</a></li>
            </ol>
        </section>
        <p:messages autoUpdate="true" id="msgs" showSummary="true" showDetail="true" closable="true"/>
        <section class="content">
            <div class="row">
                <div class="col-xs-12">
                    <div class="box box-primary"> 
                        <br/>
                        <h:form id="form">
                            <p:schedule id="schedule" value="#{calendario.eventModel}" widgetVar="myschedule" locale="es">

                                <p:ajax event="dateSelect" listener="#{calendario.onDateSelect}" update="eventDetails" oncomplete="PF('eventDialog').show();" />
                                <p:ajax event="eventSelect" listener="#{calendario.onEventSelect}" update="eventDetails" oncomplete="PF('eventDialog').show();" />
                                <p:ajax event="eventMove" listener="#{calendario.onEventMove}"  />
                                <p:ajax event="eventResize" listener="#{calendario.onEventResize}"  />

                            </p:schedule>

                            <p:dialog widgetVar="eventDialog" header="Event Details" showEffect="clip" hideEffect="clip">
                                <h:panelGrid id="eventDetails" columns="2">
                                    <h:outputLabel for="title" value="Title:" />
                                    <p:inputText id="title" value="#{calendario.event.title}" required="true" />

                                    <h:outputLabel for="from" value="From:" />
                                    <p:inputMask id="from" value="#{calendario.event.startDate}" mask="99/99/9999">
                                        <f:convertDateTime pattern="dd/MM/yyyy" />
                                    </p:inputMask>

                                    <h:outputLabel for="to" value="To:" />
                                    <p:inputMask id="to" value="#{calendario.event.endDate}" mask="99/99/9999">
                                        <f:convertDateTime pattern="dd/MM/yyyy" />
                                    </p:inputMask>

                                    <h:outputLabel for="allDay" value="All Day:" />
                                    <h:selectBooleanCheckbox id="allDay" value="#{calendario.event.allDay}" />

                                    <p:commandButton type="reset" value="Reset" />
                                    <p:commandButton id="addButton" value="Save" actionListener="#{calendario.addEvent}" oncomplete="PF('myschedule').update();PF('eventDialog').hide();" />
                                </h:panelGrid>
                            </p:dialog>    
                        </h:form>
                    </div>
                </div>
            </div>
        </section>        
    </ui:define>
</ui:composition>